<?php
// Includes
require_once("myspace\Common.php");
require_once("myspace\MyOpenSpaceAPI.php");


$opensocial_token = "MIGvBgorBgEEAYI3WAPjoIGgMIGdBM6oSO%2fvm1IkutjJa%2bHiQ%3d%3d"; // <-- CHANGE THIS
$opensocial_view = "canvas";
$opensocial_detail = DetailType::$BASIC;


$myspace = new MyOpenSpaceAPI($opensocial_token, $opensocial_view, $opensocial_detail);

// Get XML, JSON
//$myspace->set_output_array(false); //set to false to get the XML or JSON format instead of native php arrays
//$myspace->set_response_type(ResponseType::$JSON); //change the type to XML, JSON

$myspace->set_context(ContextType::$VIEWER);

//--------------------------------------------------------------------

    // GETS get_viewer_profile
    $result = $myspace->get_profile();
    echo 'get_profile';
    var_dump($result);

//Sample use of the values as output
echo '<a href="' . $result['weburi'] . '">' . $result['displayname'] . '</a><br/>';
echo '<img src="' . $result['imageuri'] . '"/>';

    echo '<hr>';

$page = null;
$page_size = null;
$list = null;

/*
//Other possible options
$page = 1;
$page_size = 5;
$list = null;
*/

/*
//Other possible options
$page = null;
$page_size = null;
$list = 'top';
*/

/*
//Other possible options
$page = 1;
$page_size = 5;
$list = 'top';
*/

    // GETS get_friends
    $result = $myspace->get_friends($page, $page_size, $list);
    echo 'get_friends';
    var_dump($result);
    echo '<hr>';
    
$album_id = null;

/*
//Other possible options
$album_id = 795861;
*/
    
    // GETS get_albums
    $result = $myspace->get_albums($album_id);
    echo 'get_albums';
    var_dump($result);
    echo '<hr>';

$album_id = 795861;

    // GETS get_albums_photos
    $result = $myspace->get_albums_photos($album_id); // CAN'T BE NULL
    echo 'get_albums_photos';
    var_dump($result);
    echo '<hr>';

$photo_id = null;

/*
//Other possible options
$photo_id = null;
*/

    // GETS get_photos
    $result = $myspace->get_photos($photo_id);
    echo 'get_photos';
    var_dump($result);
    echo '<hr>';
    
$video_id = null;

/*
//Other possible options
$video_id = 1234;
*/

    // GETS get_videos
    $result = $myspace->get_videos($video_id);
    echo 'get_videos';
    var_dump($result);
    echo '<hr>';        

$key = null;

/*
//Other possible options
$key = 'option1';
*/

    // GETS get_global_appdata
    $result = $myspace->get_global_appdata($key);
    echo 'get_global_appdata';
    var_dump($result);
    echo '<hr>';

$key = null;

/*
//Other possible options
$key = 'option1';
*/

    // GETS get_appdata
    $result = $myspace->get_appdata($key);
    echo 'get_appdata';
    var_dump($result);
    echo '<hr>';

$key = null;

/*
//Other possible options
$key = 'option1';
*/

    // GETS get_friends_appdata
    $result = $myspace->get_friends_appdata($key);
    echo 'get_friends_appdata';
    var_dump($result);
    echo '<hr>';
?>